#include <iostream>

using namespace std;

class A
{
public:
	A() { func(); }
	virtual void func() { cout << "A" << endl; }
};

class B : public A
{
public:
	B() { func(); }
	void func() { cout << "B" << endl; }

};

class C : public A
{
public:
	C() { func(); }
	void func() { cout << "C" << endl; }

};
int main()
{
	A* a1 = new B;
	A* a2 = new C;

	a1->func();
	a2->func();

	return 0;
}